(function () {

    "use strict";

    /**
     * 'Unpaid','Pending','Dispatch','Complete', 'Refund'
     **/
    var api = {
        getExpUrl: '/api/order/express'
    };

    sm.controller('wx-order-express-controller', ['$scope', '$http', 'Toast', function ($scope, $http, Toast){

        $scope.lists = [];
        $scope.info = {};
        $scope.error = '';

        Toast.loading();
        $http.get(api.getExpUrl, {
            params: {
                orderId: GetQueryString('orderId')
            }
        }).success(function (res) {
            Toast.stop();
            if (res.state) {

                $scope.info.expTextName = res.data.expTextName;
                $scope.info.expressNo = res.data.expressNo;
                $scope.info.tel = res.data.tel;
                $scope.info.updateStr = res.data.updateStr;

                if (res.data && res.data.data) {
                    $scope.lists = res.data.data;
                } else {
                    $scope.lists = [];
                }
            } else {
                $scope.error = res.error ? res.error : '暂无跟踪记录';
            }
        }).error(function () {
            Toast.stop();
            Toast.error();
        });

    }]);
})();

